<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('用户列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
						

							<li>
								姓名：<input type="text" name="realname"/>
							</li>

							<li>
								电话号码：<input type="text" name="mobile"/>
							</li>

							<li>
								微信名称：<input type="text" name="nickname"/>
							</li>

							

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()" id="listSearch"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				
				<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="User:user:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('User:user:edit')}]];
        var removeFlag = [[${@permission.hasPermi('User:user:remove')}]];
        var prefix = ctx + "User/userVerify";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "用户",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '',
					visible: false
				},
				
				
				{
					field : 'realname', 
					title : '姓名',
					sortable: true
				},
				{
					field : 'mobile', 
					title : '电话号码',
					sortable: true
				},
				
				{
					field : 'nickname', 
					title : '微信名称',
					sortable: true
				},
				{
					field : 'credit2', 
					title : '金币',
					sortable: true
				},
				{
					field : 'credit1', 
					title : '账户余额',
					sortable: true
				},
				
				{
					field : 'gender', 
					title : '性别',
					sortable: true
				},
				
				{
					title: '头像',
				    formatter: function(value, row, index) {
				    	if($.common.isEmpty(row.avatar)){
				    		return $.table.imageView('http://demo.ruoyi.vip/ruoyi.png');
				    	} else {
				    		return $.table.imageView(row.avatar);
				    	}
				    	// 图片预览（注意：如存储在本地直接获取数据库路径，如有配置context-path需要使用ctx+路径）
				    	// 如：/profile/upload/2019/08/08/3b7a839aced67397bac694d77611ce72.png
				    	/* if(index % 2 == 0){
				    		return $.table.imageView('/profile/avatar/2019/07/19/e9708796bb68b17dd1ffa1faea25ece7.jpg');
				    	}else {
				    		return $.table.imageView('http://demo.ruoyi.vip/ruoyi.png');
				    	} */
				    }
					},
				
				
				
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="userUpdate(\'' + row.id + '\')"><i class="fa fa-edit"></i>填写骑手信息</a> ');
                        actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="updateStatus(\'' + row.id + '\')"><i class="fa fa-edit"></i>同意申请</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="updateStatus2(\'' + row.id + '\')"><i class="fa fa-edit"></i>驳回申请</a> ');
                        //actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="testPay(\'' + row.id + '\')"><i class="fa fa-edit"></i>测试打钱</a> ');
                        return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        
        function userUpdate(id) {
        	$.modal.open('骑手详情', prefix + "/edit/" + id, '1300', '800');			
		}
        
        function updateStatus(id) {
        	$.modal.confirm("是否确认通过申请？", function() {
    			var url = prefix + "/updateStatus";
    			var data = { "id": id };
        	    $.operate.submit(url, "post", "json", data);
        	    var buy = document.getElementById('listSearch');//给你的a标签加一个id :btnBuy
				buy.click();
    		});
        } 
        
        function updateStatus2(id) {
        	$.modal.confirm("是否确认驳回申请？", function() {
    			var url = prefix + "/updateStatus2";
    			var data = { "id": id };
        	    $.operate.submit(url, "post", "json", data);
        	    var buy = document.getElementById('listSearch');//给你的a标签加一个id :btnBuy
				buy.click();
    		});
        }
        
        /* function updateStatus(id) {
        	 $.ajax({
    	         url:prefix + "/updateStatus",
    	         data:id,
    	        	success : function() {
    	        	var buy = document.getElementById('listSearch');//给你的a标签加一个id :btnBuy
    				buy.click();
    	        } 
    	    )}
        } */
        
        function testPay(id) {
        	$.modal.confirm("是否确认驳回申请？", function() {
    			var url = prefix + "/testPay";
    			var data = { "id": id };
        	    $.operate.submit(url, "post", "json", data);
        	    var buy = document.getElementById('listSearch');//给你的a标签加一个id :btnBuy
				buy.click();
    		});
        }
        
        
       
    </script>
</body>
</html>